/**
 * Created by Richard Radlherr.
 * Date: 27.06.2006 07:29
 */

using System;

namespace TagTool.Core
{

	/**
	 * The NodeFactory performas the creation of nodes.
	 */
	public class NodeFactory
	{
		private static NodeFactory factory = new NodeFactory();
		
		private NodeFactory()
		{
		}
		
		public static NodeFactory Instance
		{
			get
			{
				if (factory == null)
				{
					factory = new NodeFactory();
				}
				return factory; 
			}
		}
		
		public BaseNode CreateNode(String assembly, String nodeTypeName)
		{
			BaseNode node = null;
			AssemblyManager manager = AssemblyManager.GetInstance(assembly);
			if (manager != null)
			{
				node = manager.Create(nodeTypeName);
			}
			return node;
		}

	}

}
